package com.qianfeng.client_7001.service;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.cache.annotation.CacheKey;
import com.netflix.hystrix.contrib.javanica.cache.annotation.CacheRemove;
import com.netflix.hystrix.contrib.javanica.cache.annotation.CacheResult;
import com.qianfeng.client_7001.client.SearchClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * author: 田晋宇
 * datetime:2021/10/26 14:34
 * email:853796359@qq.com
 */
@Service
public class CustomerService {

    @Autowired
    private SearchClient searchClient;




    @CacheResult
    @HystrixCommand(commandKey = "c5")
    public String c5(@CacheKey Integer id){

        String s1 = searchClient.s1(id);
        System.out.println(s1);
        return "ok";
    }


    @CacheRemove(commandKey = "c5")
    @HystrixCommand
    public void clearCache(@CacheKey  Integer id){
        System.out.println("缓存被清除");
    }


}
